﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using InformationSystem.BLL.Core.Model;
using InformationSystem.BLL.Core.Service;

namespace InformationSystem.WebSite.Module.NoticeMgr
{
    public partial class ReadList : BasePage
    {
        protected LoginUser user;
        public IInformationService InformationService { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            user = (LoginUser)Session["LoginUser"];
            if (Request.QueryString["m"] == null) return;
            string m = Request.QueryString["m"].ToLower();
            int id = 0;
            if (Request.QueryString["id"] == null) return;
            if (!int.TryParse(Request.QueryString["id"], out id)) return;
            this.DataLoadProgress(m, id);
        }

        private void DataLoadProgress(string type, int id)
        {
            switch (type)
            {
                case "affiche":
                    IList<RecvUser> recvuseraff = InformationService.GetAfficheReadList(id);
                    readlistStore.DataSource = recvuseraff;
                    readlistStore.DataBind();
                    break;
                case "workinfo":
                    IList<RecvUser> recvuserwork = InformationService.GetWorkInfoReadList(id);
                    readlistStore.DataSource = recvuserwork;
                    readlistStore.DataBind();
                    break;
                case "msg":
                    IList<RecvUser> recvusermsg = InformationService.GetMsgReadList(id);
                    readlistStore.DataSource = recvusermsg;
                    readlistStore.DataBind();
                    break;
            }
        }
        protected override bool CommitPermissionCheck()
        {
            throw new NotImplementedException();
        }
    }
}